package com.longxi.tianjintianbao.ui.activity.oa;

import android.content.Intent;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.oa.CostApplyAtPresenter;
import com.longxi.tianjintianbao.ui.view.oa.ICostApplyAtView;

import butterknife.BindView;

public class CostApplyActivity extends BaseActivity<ICostApplyAtView, CostApplyAtPresenter> implements ICostApplyAtView {
    @BindView(R.id.etProjectName)
    EditText mEtProjectName;
    @BindView(R.id.etUse)
    EditText mEtUse;
    @BindView(R.id.tvLoanType)
    TextView mTvLoanType;

    @BindView(R.id.etUpperAmount)
    EditText mEtUpperAmount;
    @BindView(R.id.tvSwitch)
    TextView mTvSwitch;

    @BindView(R.id.etLowerAmount)
    EditText mEtLowerAmount;
    @BindView(R.id.etSupplier)
    EditText mEtSupplier;
    @BindView(R.id.etAccounts)
    EditText mEtAccounts;
    @BindView(R.id.etOpeningBank)
    EditText mEtOpeningBank;
    @BindView(R.id.etExplain)
    EditText mEtExplain;
    @BindView(R.id.tvAuditingName)
    TextView mTvAuditingName;
    @BindView(R.id.tvPersonnelName)
    TextView mTvPersonnelName;

    @BindView(R.id.btnLogin)
    Button mBtnLogin;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_cost_apply;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mBtnLogin.setOnClickListener(v -> mPresenter.saveCostApply());
        mTvLoanType.setOnClickListener(v -> mPresenter.showLoanTypeDialog());
        mTvSwitch.setOnClickListener(v -> mPresenter.SwitchNumToUpper());
        mTvAuditingName.setOnClickListener(v -> mPresenter.showAuditing());
        mTvPersonnelName.setOnClickListener(v -> mPresenter.showPersonnel());
        mEtLowerAmount.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                mPresenter.SwitchNumToUpper();
            }

            @Override
            public void afterTextChanged(Editable editable) {

            }
        });
    }

    @Override
    protected CostApplyAtPresenter createPresenter() {
        return new CostApplyAtPresenter(this);
    }

    @Override
    public EditText getEtProjectName() {
        return mEtProjectName;
    }

    @Override
    public EditText getEtUse() {
        return mEtUse;
    }

    @Override
    public TextView getTvLoanType() {
        return mTvLoanType;
    }

    @Override
    public EditText getEtUpperAmount() {
        return mEtUpperAmount;
    }

    @Override
    public EditText getEtLowerAmount() {
        return mEtLowerAmount;
    }

    @Override
    public EditText getEtSupplier() {
        return mEtSupplier;
    }

    @Override
    public EditText getEtAccounts() {
        return mEtAccounts;
    }

    @Override
    public EditText getEtOpeningBank() {
        return mEtOpeningBank;
    }

    @Override
    public EditText getEtExplain() {
        return mEtExplain;
    }

    @Override
    public TextView getTvAuditingName() {
        return mTvAuditingName;
    }

    @Override
    public TextView getTvPersonnelName() {
        return mTvPersonnelName;
    }

    @Override
    public Button getBtnLogin() {
        return mBtnLogin;
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    }

}


